package cn.net.zidian.mvvm.activity;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import org.simple.eventbus.EventBus;

import cn.net.zidian.mvvm.vm.BaseViewModel;

public abstract class BaseActivity<T extends BaseViewModel> extends AppCompatActivity {

    protected T vm;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        vm = viewModel();
        EventBus.getDefault().register(this);
        initView();
    }

    protected abstract T viewModel();

    protected abstract void initView();

}
